package main

import (
	"fmt"
	_ "runtime"
	"sync"
	"time"
)

var wg sync.WaitGroup

func a() {
	defer wg.Done()
	for i := 0; i < 100; i++ {
		fmt.Println("a->", i)
		time.Sleep(time.Millisecond * 10)
	}
}

func b() {
	defer wg.Done()
	for i := 0; i < 100; i++ {
		fmt.Println("b->", i)
		time.Sleep(time.Millisecond * 10)
	}
}

func main() {
	// runtime.GOMAXPROCS(2)
	wg.Add(2)
	go a()
	go b()
	wg.Wait()
}
